package com.pc_project.controller;


import com.pc_project.domain.Audit;
import com.pc_project.domain.VO.AuditLogin;
import com.pc_project.domain.VO.JsonVO;
import com.pc_project.domain.VO.ResultStatus;
import com.pc_project.service.AuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/audit")
@Api(tags = "审核者分组")
public class AuditController {

    @Autowired
    AuditService auditService;


    @ApiOperation("登录接口")
    @PostMapping("login")
    public JsonVO login (@RequestBody Map<String,String> map) {
        return auditService.login(map.get("ausername"), map.get("apassword"));
    }

    @PreAuthorize("hasAuthority('audit')")
    @ApiOperation("登出接口")
    @PostMapping("logout")
    public JsonVO logout() {
        return auditService.logout();
    }
}
